﻿<%@ Page Language="C#" MasterPageFile="~/web.master" AutoEventWireup="true" CodeBehind="maintenance_visit_list.aspx.cs" Inherits="Shuba.Web.master.maintenance_visit_list" %>

<%@ Register Assembly="Shuba.Framework" Namespace="Shuba.Framework" TagPrefix="cc" %>
<asp:Content ID="Header1" ContentPlaceHolderID="HeaderPlaceHolder" runat="server">

    <script type="text/javascript">
        function PrintThis() {
            var txt = document.getElementById('<%= txtSearch.ClientID %>').value;
            window.open("maintenance_visit_list_excel.aspx?txtSearch=" + txt);
        }
        function CheckAll() {
            var checkVal;
            if (document.all("ButSelect").value == "Check All") {
                checkVal = true;
                document.all("ButSelect").value = "Un-Check All";
            } else {
                checkVal = false;
                document.all("ButSelect").value = "Check All";
            }

            for (var n = 0; n < document.forms[0].length; n++) {
                elm = document.forms[0].elements[n];
                if (elm.type == 'checkbox') {
                    elm.checked = checkVal;
                }
            }
        }
    </script>

</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table class="text" border="0" width="100%" cellspacing="0" cellpadding="2">
        <tr>
            <td class="text bg_content" bgcolor="#FFFFFF" align="center">
                <p>
                    &nbsp;</p>
                <table class="black" border="0" width="95%" cellspacing="0" cellpadding="0">
                    <tr>
                        <td class="title_back" align="left">
                            <table class="text" border="0" width="100%" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td class="title_back2" width="2%">
                                        &nbsp;
                                    </td>
                                    <td class="title_back2 title_white" width="38%">
                                        <asp:Label ID="LabelTitle" runat="server" Text="Label"></asp:Label>
                                    </td>
                                    <td>
                                        <span class="title_right"></span>
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td class="title_back" align="right">
                            <asp:LinkButton ID="btnUpload" runat="server" PostBackUrl="maintenance_visit_monitoring.aspx"
                                CssClass="black">Maintenance Visit Monitoring</asp:LinkButton>&nbsp;&nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td class="border_left bg_subtitle_white">
                            &nbsp;&nbsp;&nbsp;List
                        </td>
                        <td class="border_right bg_subtitle" align="right">
                            CIF / Debtor Name&nbsp;<asp:TextBox ID="txtSearch" CssClass="text" runat="server"></asp:TextBox>&nbsp;
                            <asp:Button ID="btnSearch" CssClass="buttonsmall" runat="server" Text="Search" OnClick="btnSearch_Click" />&nbsp;&nbsp;
                            <input type="button" value="Export to Excel" onclick="PrintThis();" class="button" />&nbsp;&nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <table class="border" width="100%">
                                <tr>
                                    <td class="text">
                                        <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                                            <ContentTemplate>
                                                <cc:SHUBAGrid ID="gvList" runat="server" AutoGenerateColumns="False" Width="100%"
                                                    DataKeyNames="RECORD_ID" AllowPaging="True" PageSize="20" OnPageIndexChanging="gvList_PageIndexChanging"
                                                    OnRowDataBound="gvList_RowDataBound" OnRowCommand="gvList_RowCommand" AllowSorting="True"
                                                    OnSorting="gvList_Sorting" BorderWidth="1px" CellPadding="2" CssClass="text" EnableModelValidation="True" ItemsCount="0" UseCustom="False">
                                                    <AlternatingRowStyle CssClass="bg_grid2" />
                                                    <Columns>
                                                        <asp:BoundField DataField="RECORD_ID" HeaderText="RECORD ID" />
                                                        <asp:BoundField DataField="UNIT_CODE" HeaderText="UNIT CODE" SortExpression="UNIT_CODE"
                                                            ItemStyle-HorizontalAlign="Center" >
                                                        <ItemStyle HorizontalAlign="Center" />
                                                        </asp:BoundField>
                                                        <asp:BoundField DataField="AO_CODE" HeaderText="AO Code" />
                                                        <asp:BoundField DataField="NIPTeller" HeaderText="Nip Teller" />
                                                        <asp:BoundField DataField="CIF" HeaderText="CIF No" SortExpression="CIF"
                                                            ItemStyle-HorizontalAlign="Center" >
                                                        <ItemStyle HorizontalAlign="Center" />
                                                        </asp:BoundField>
                                                        <asp:BoundField DataField="NO_ACCOUNT" HeaderText="Account No" SortExpression="NO_ACCOUNT"
                                                            ItemStyle-HorizontalAlign="Center" >
                                                        <ItemStyle HorizontalAlign="Center" />
                                                        </asp:BoundField>
                                                        <asp:BoundField DataField="DEBTOR_NAME" HeaderText="DEBTOR NAME" SortExpression="DEBTOR_NAME"
                                                            ItemStyle-HorizontalAlign="Left" >
                                                        <ItemStyle HorizontalAlign="Left" />
                                                        </asp:BoundField>
                                                        <asp:BoundField DataField="EXTEND_DATE" HeaderText="Tgl. Rencana Kunjungan" />
                                                        <asp:BoundField DataField="DATA_TYPE" HeaderText="Data Type" />
                                                        <asp:BoundField DataField="EXPIRY_DATE" HeaderText="EXPIRY_DATE" />
                                                        <asp:BoundField DataField="OBJECTIVE_OF_VISIT" HeaderText="Tunjuan Kunjungan" />
                                                        <asp:TemplateField ItemStyle-HorizontalAlign="Center">
                                                            <ItemTemplate>
                                                                <asp:LinkButton ID="btnDelete" runat="server" CommandArgument='<%#Eval("RECORD_ID")%>' CommandName="Remove" CssClass="line" OnClientClick="return confirm('Are you sure, you want to delete this record')">[&nbsp;&nbsp;DELETE&nbsp;&nbsp;]</asp:LinkButton>                                                                
                                                            </ItemTemplate>
                                                            <HeaderStyle Width="5%" />
                                                            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                                        </asp:TemplateField>
                                                    </Columns>
                                                    <PagerSettings Mode="Numeric" Visible="true" />
                                                    <EmptyDataRowStyle CssClass="bg_grid2" />
                                                    <EmptyDataTemplate>
                                                        <table class="text" width="100%" cellpadding="0" cellspacing="0">
                                                            <tr>
                                                                <td class="bg_grid2" align="center">
                                                                    NO RECORD FOUND
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </EmptyDataTemplate>
                                                    <FooterStyle CssClass="bg_footer" />
                                                    <HeaderStyle CssClass="bg_title" ForeColor="White" />
                                                    <PagerStyle CssClass="bg_footer" HorizontalAlign="Right" />
                                                    <RowStyle CssClass="bg_grid" />
                                                </cc:SHUBAGrid>
                                            </ContentTemplate>
                                            <Triggers>
                                                <asp:AsyncPostBackTrigger ControlID="gvList" EventName="PageIndexChanging" />
                                                <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
                                                <asp:AsyncPostBackTrigger ControlID="ddlMaintenanceVisitPage" EventName="SelectedIndexChanged" />
                                            </Triggers>
                                        </asp:UpdatePanel>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <asp:UpdatePanel ID="UpdatePanel3" runat="server">
                                            <ContentTemplate>
                                                <div id="footLink" class="bg_footer text" runat="server">
                                                    <table width="100%">
                                                        <tr>
                                                            <td class="text">
                                                                <asp:ImageButton ID="firstLink" runat="server" CssClass="icon_first" OnClick="linkDataPage_Click"
                                                                    ImageUrl="~/images/trans.gif" />
                                                                <asp:ImageButton ID="prevLink" runat="server" CssClass="icon_previous" OnClick="linkDataPage_Click"
                                                                    ImageUrl="~/images/trans.gif" />
                                                                <asp:DropDownList ID="ddlMaintenanceVisitPage" runat="server" CssClass="text" OnSelectedIndexChanged="ddlMaintenanceVisitPage_IndexChange"
                                                                    AutoPostBack="true">
                                                                </asp:DropDownList>
                                                                <asp:ImageButton ID="nextLink" runat="server" CssClass="icon_next" OnClick="linkDataPage_Click"
                                                                    ImageUrl="~/images/trans.gif" />
                                                                <asp:ImageButton ID="lastLink" runat="server" CssClass="icon_last" OnClick="linkDataPage_Click"
                                                                    ImageUrl="~/images/trans.gif" />
                                                            </td>
                                                            <td style="text-align: right">
                                                                <asp:Label ID="lblPage" runat="server" Text="Page" CssClass="text"></asp:Label>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </div>
                                            </ContentTemplate>
                                            <Triggers>
                                                <asp:AsyncPostBackTrigger ControlID="gvList" EventName="PageIndexChanging" />
                                                <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
                                                <asp:AsyncPostBackTrigger ControlID="ddlMaintenanceVisitPage" EventName="SelectedIndexChanged" />
                                            </Triggers>
                                        </asp:UpdatePanel>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
                <br />
                <!-- Error Message -->
                <table runat="server" visible="false" id="ErrBox" border="0" width="100%" cellspacing="0"
                    cellpadding="2">
                    <tr>
                        <td class="bg_grid2" align="center">
                            <asp:Label ID="ErrMsg" runat="server" Text="" Font-Bold="true" ForeColor="Red"></asp:Label>
                        </td>
                    </tr>
                </table>
                <!-- End Of Error Message -->
                <!-- APPROVAL START HERE -->
                <br />
                <br />
                <asp:Panel ID="ApprovalPnl" Visible="false" runat="server">
                    <table class="black" border="0" width="95%" cellspacing="0" cellpadding="0">
                        <tr>
                            <td class="title_back" align="left" width="40%">
                                <table class="text" border="0" width="100%" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td class="title_back2" width="2%">
                                            &nbsp;
                                        </td>
                                        <td class="title_back2 title_white" width="38%">
                                            Need for Approval
                                        </td>
                                        <td>
                                            <span class="title_right" width="60%"></span>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                            <td class="title_back" align="right">
                                &nbsp;&nbsp;
                            </td>
                        </tr>
                        <tr>
                            <!-- start penambahan -->
                            <td colspan="2">
                                <table class="border" width="100%">
                                    <tr>
                                        <td class="text">
                                            <!-- END penambahan -->
                                            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                                                <ContentTemplate>
                                                    <cc:SHUBAGrid ID="ApprovalGrid" runat="server" AutoGenerateColumns="False" Width="100%"
                                                        DataKeyNames="CIF,RECORD_ID" AllowPaging="True" PageSize="20" OnPageIndexChanging="ApprovalGrid_PageIndexChanging"
                                                        AllowSorting="True" OnSorting="ApprovalGrid_Sorting" BorderWidth="1px" CellPadding="2" CssClass="text" EnableModelValidation="True" ItemsCount="0" UseCustom="False">
                                                        <AlternatingRowStyle CssClass="bg_grid2" />
                                                        <Columns>
                                                            <asp:TemplateField HeaderStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Middle" HeaderStyle-Width="10%" ItemStyle-HorizontalAlign="Center">
                                                                <HeaderTemplate>
                                                                    <input id="ButSelect" class="button" name="ButSelect" onclick="CheckAll()" type="button" value="Check All"> </input>
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                    <asp:CheckBox ID="chkItemSelect" runat="server" />
                                                                </ItemTemplate>
                                                                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="10%" />
                                                                <ItemStyle HorizontalAlign="Center" />
                                                            </asp:TemplateField>
                                                            <asp:BoundField DataField="RECORD_ID" HeaderText="RECORD_ID" ItemStyle-HorizontalAlign="Center" />
                                                            <asp:BoundField DataField="UNIT_CODE" HeaderText="UNIT_CODE" ItemStyle-HorizontalAlign="Center" />
                                                            <asp:BoundField DataField="CIF" HeaderText="CIF" ItemStyle-HorizontalAlign="Center" />
                                                            <asp:BoundField DataField="NO_ACCOUNT" HeaderText="NO_ACCOUNT" ItemStyle-HorizontalAlign="Left" />
                                                            <asp:BoundField DataField="DEBTOR_NAME" HeaderText="DEBTOR_NAME" ItemStyle-HorizontalAlign="Center" />
                                                            <asp:BoundField DataField="ACT_TYPE" HeaderText="ACT_TYPE" ItemStyle-HorizontalAlign="Center" />
                                                        </Columns>
                                                        <PagerSettings Mode="Numeric" Visible="true" />
                                                        <EmptyDataRowStyle CssClass="bg_grid2" />
                                                        <FooterStyle CssClass="bg_footer" />
                                                        <HeaderStyle CssClass="bg_title" ForeColor="White" />
                                                        <PagerStyle CssClass="bg_footer" HorizontalAlign="Right" />
                                                        <RowStyle CssClass="bg_grid" />
                                                    </cc:SHUBAGrid>
                                                </ContentTemplate>
                                                <Triggers>
                                                    <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
                                                </Triggers>
                                            </asp:UpdatePanel>
                                        </td>
                                    </tr>
                                    <!-- ddl Approval & next,prev -->
                                    <tr>
                                        <td>
                                            <asp:UpdatePanel ID="UpdatePanel4" runat="server">
                                                <ContentTemplate>
                                                    <div id="footLinkApproval" class="bg_footer text" runat="server">
                                                        <table width="100%">
                                                            <tr>
                                                                <td class="text">
                                                                    <asp:ImageButton ID="firstLinkApproval" runat="server" CssClass="icon_first" OnClick="linkDataApprovalPage_Click"
                                                                        ImageUrl="~/images/trans.gif" />
                                                                    <asp:ImageButton ID="prevLinkApproval" runat="server" CssClass="icon_previous" OnClick="linkDataApprovalPage_Click"
                                                                        ImageUrl="~/images/trans.gif" />
                                                                    <asp:DropDownList ID="ddlApproval" runat="server" CssClass="text" OnSelectedIndexChanged="ddlApproval_IndexChange"
                                                                        AutoPostBack="true">
                                                                    </asp:DropDownList>
                                                                    <asp:ImageButton ID="nextLinkApproval" runat="server" CssClass="icon_next" OnClick="linkDataApprovalPage_Click"
                                                                        ImageUrl="~/images/trans.gif" />
                                                                    <asp:ImageButton ID="lastLinkApproval" runat="server" CssClass="icon_last" OnClick="linkDataApprovalPage_Click"
                                                                        ImageUrl="~/images/trans.gif" />
                                                                </td>
                                                                <td style="text-align: right">
                                                                    <asp:Label ID="lblPageApproval" runat="server" Text="Page" CssClass="text"></asp:Label>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </div>
                                                </ContentTemplate>
                                                <Triggers>
                                                    <asp:AsyncPostBackTrigger ControlID="ApprovalGrid" EventName="PageIndexChanging" />
                                                    <asp:AsyncPostBackTrigger ControlID="ddlApproval" />
                                                </Triggers>
                                            </asp:UpdatePanel>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2" align="left" class="bg_footer" height="30">
                                            &nbsp;
                                            <asp:Button ID="btnApprove" Text="Approve" runat="server" CssClass="button" OnClick="btnApprove_Click"
                                                OnClientClick="return ApproveValidate();" />
                                            <asp:Button ID="btnApproveAll" Text="Approve All" runat="server" CssClass="button"
                                                OnClick="btnApproveAll_Click" OnClientClick="return confirm('Are you sure, you want to approve all record(s) ?')" />
                                            <asp:Button ID="btnReject" Text="Reject" runat="server" CssClass="button" OnClick="btnReject_Click"
                                                OnClientClick="return RejectValidate();" />
                                            <asp:Button ID="btnRejectAll" Text="Reject All" runat="server" CssClass="button"
                                                OnClick="btnRejectAll_Click" OnClientClick="return confirm('Are you sure, you want to reject all record(s) ?')" />
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
                <!-- END OF APPROVALE -->
            </td>
        </tr>
    </table>
</asp:Content>
